/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-07 19:44:56  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.bp.repository;

import java.util.List;

import com.joysuch.wwyt.bp.entity.BpWorkSafetyCertUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

/**
 * BpWorkSafetyCertUserDao
 * 
 */
public interface BpWorkSafetyCertUserDao
        extends JpaRepository<BpWorkSafetyCertUser, Long>, QuerydslPredicateExecutor<BpWorkSafetyCertUser> {
    public Page<BpWorkSafetyCertUser> findAll(Specification<BpWorkSafetyCertUser> spec, Pageable pageable);

    public BpWorkSafetyCertUser save(BpWorkSafetyCertUser bean);

    public void delete(BpWorkSafetyCertUser bean);

    public List<BpWorkSafetyCertUser> findByWorkId(Long workId);

    public void deleteByWorkId(Long workId);

    @Query("select count(m) from BpWorkSafetyCertUser m where m.workId = ?1")
    Integer countOfWorkId(Long workId);
}
